<!DOCTYPE html>
<meta charset="UTF-8">
<body>
<style type="text/css">
	.layui-form-item{
		margin: 20px 100px 10px 45px;
	}
</style>
<form class="layui-form" action="save" method="post" lay-filter="stuform" style="margin-bottom: 20px;">
	<input type="hidden" name="id" data-th-value="${model.id}">
	<input type="hidden" name="isUsed" data-th-value="${model.isUsed}">
	<input type="hidden" name="createName" data-th-value="${model.createName}">
	<input type="hidden" name="createDate" data-th-value="${model.createDate}">
	<input type="hidden" name="parentId" th:value="${model.parent==null?null:model.parent.id}">
	
	<div th:if="${model.parentId==0}">
		<div class="layui-form-item">
			<label class="layui-form-label">名称：</label>
			<div class="layui-input-block">
				<input type="text" name="name" data-th-value="${model.name}" class="layui-input" />
			</div>
		</div>
		<div class="layui-form-item">
    		<label class="layui-form-label">代码：</label>
    		<div class="layui-input-block">
      			<input type="text" name="code" data-th-value="${model.code}" class="layui-input">
    		</div>
  		</div>
	</div>
	<div th:if="${model.parentId!=0}">
		<div class="layui-form-item">
    		<label class="layui-form-label">权限：</label>
    		<div class="layui-input-block">
				<select name="permissionCode">
					<option value="" style="display: none;"></option>
					<option th:each="c:${roles}" th:text="${c.name}" th:value="${c.code}" th:selected="${model.code==c.code}" />
				</select>
    		</div>
  		</div>
	</div>
	<div class="layui-form-item">
   		<label class="layui-form-label">排序：</label>
   		<div class="layui-input-block">
     		<input type="text" name="idx" data-th-value="${model.idx}" class="layui-input">
   		</div>
 	</div>
</form>
<script type="text/javascript">
	form = layui.form;
	form.render('select');
</script>
</body>
</html>